package com.mall.untils;
import java.io.IOException;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PropertiesUtil { 
	public static Logger logger = LoggerFactory.getLogger(PropertiesUtil.class);
	// 支付宝支付的属性文件
	private static Properties aLiPayConfig=new Properties();
	// 微信支付的属性文件
	private static Properties wxpayConfig=new Properties();  
    /** 
     * 读取properties配置文件信息 
     */  
    static{
        try {         
            aLiPayConfig.load(PropertiesUtil.class.getClassLoader().getResourceAsStream("conf_alipay.properties"));
            wxpayConfig.load(PropertiesUtil.class.getClassLoader().getResourceAsStream("conf_wxpay.properties"));
        } catch (IOException e) {  
            e.printStackTrace();   
            logger.info("默认加载配置文件出错");
        }  
    }  
    /** 
     * 根据key获取支付宝属性文件中value的值 
     */
    public static String getALiPayProperties (String key){
		return aLiPayConfig.getProperty(key);
	}
    /** 
     * 根据key获取微信属性文件中value的值 
     */ 
    public static String getWxpayProperties (String key){
  		return wxpayConfig.getProperty(key);
  	}
} 